home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / sortdemo.zip / SDKEY.INC < prev    next >
Text File  |  1992-04-12  |  2KB  |  55 lines

  1. (*
  2. ╔═══════════════════════════════════════════════════════════════════════════╗
  3. ║ Turbo Pascal 6.0 Include File : SDKEY.INC                                 ║
  4. ╟───────────────────────────────────────────────────────────────────────────╢
  5. ║ Program : SORTDEMO.PAS                                                    ║
  6. ╟───────────────────────────────────────────────────────────────────────────╢
  7. ║ Version : 1.0                                                             ║
  8. ╟───────────────────────────────────────────────────────────────────────────╢
  9. ║ Copyright (c) 1992  by  Jon S. Russell                                    ║
  10. ╟───────────────────────────────────────────────────────────────────────────╢
  11. ║ Basic keyboard routines for SORTDEMO.PAS                                  ║
  12. ╚═══════════════════════════════════════════════════════════════════════════╝
  13.                                                                            *)
  14. procedure FlushKeyBuffer;
  15. var
  16.   junk : char;
  17.  
  18. begin  (* FlushKeyBuffer *)
  19.   repeat
  20.     if KeyPressed then junk := ReadKey;
  21.   until not KeyPressed;
  22. end;   (* FlushKeyBuffer *)
  23.  
  24. (*─────────────────────────────────────────────────────────────────────────*)
  25.  
  26. procedure Wait;
  27. begin  (* Wait *)
  28.   repeat
  29.   until KeyPressed;
  30. end;   (* Wait *)
  31.  
  32. (*─────────────────────────────────────────────────────────────────────────*)
  33.  
  34. procedure FlushAndWait;
  35. begin  (* FlushAndWait *)
  36.   FlushKeyBuffer;
  37.   Wait;
  38. end;   (* FlushAndWait *)
  39.  
  40. (*─────────────────────────────────────────────────────────────────────────*)
  41.  
  42. procedure GetKey (var KeyRec : KeyRecType);
  43. begin  (* GetKey *)
  44.   KeyRec.Ch := readkey;
  45.   if KeyRec.Ch <> #0
  46.     then KeyRec.Extended := false
  47.     else
  48.       begin
  49.         KeyRec.Extended := true;
  50.         KeyRec.Ch := readkey;
  51.       end;
  52. end;   (* GetKey *)
  53.  
  54. (*─────────────────────────────────────────────────────────────────────────*)
  55.